<html>
<head>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js"></script>

    <script type="text/javascript">
        function deleteBill(uuid) {
            $.post("/delete", {uuid: uuid}, function (result) {
                alert(result);
                window.location.reload(true);
            });
        }
    </script>
</head>
<form action="submit">
    <table align="center" width="90%" border=1 bordercolor="#00ff99">
        <tbody>
        <tr>
            <td bgcolor="#008b8b" colspan="3" align="center">
                <h2><b>点单结果</b></h2>
                <font color="#f0f8ff">每份的折扣价=（订单总价-满减价）/订单总价*每份的原价</font>
            </td>
            <td bgcolor="#008b8b" colspan="1" align="center">
                <a href="/hallList">返回餐厅列表</a>
            </td>
        </tr>
        <%
        for(entry in map){
        var hall = entry.key;
        var foodListMap = entry.value;
        var count = 1;
        %>
        <tr>
            <td bgcolor="#deb887" colspan="4" align="center">
                <b>餐厅：${hall.name}</b>
                <br/>
                <font color="#a52a2a">${hall.disInfo}</font>
            </td>
        </tr>
        <%
        for(foodListEntry in foodListMap){
        var disInfo = foodListEntry.key;
        var foodList = foodListEntry.value;
        %>
        <tr>
            <td bgcolor="#ff8c00" colspan="3" align="center">
                <b>第${count++}单</b>
            </td>
            <td bgcolor="aqua" colspan="1" align="center">
                <a href="/pay/${disInfo}-${hall.id}" target="_blank">去付款</a>
            </td>
        </tr>
        <tr>
            <td bgcolor="#5f9ea0" colspan="1" align="center">
                <div><b>姓名+工号</b></div>
            </td>
            <td bgcolor="#5f9ea0" colspan="1" align="center">
                <div><b>餐名</b></div>
            </td>
            <td bgcolor="#5f9ea0" colspan="1" align="center">
                <div><b>原价</b></div>
            </td>
            <td bgcolor="#5f9ea0" colspan="1" align="center">
                <div><b>折扣价</b></div>
            </td>
        </tr>
        <%
        var sum = 0;
        var dis_sum=0;
        for(food in foodList){
        %>

        <%
        if(ownerNo == food.ownerNo){
        %>
        <tr bgcolor="#7fff00">
            <%
            }else{

            %>
        <tr>
            <%
            }
            %>
            <td colspan="1" align="center">
                <div>${food.owner}_${food.ownerNo}</div>
            </td>
            <td colspan="1" align="center">
                <div>${food.name}</div>
            </td>
            <td colspan="1" align="right">
                <div>${food.price/10}</div>
            </td>
            <td colspan="1" align="right">
                <div>${food.disPrice/10,numberFormat="##.##"}</div>
                <div><a href="#" onclick="deleteBill('${food.uuid}')">删除</a></div>
            </td>
        </tr>

        <%
        sum = sum + food.price;
        dis_sum = dis_sum + food.disPrice;
        }
        %>
        <tr>
            <td colspan="2" align="center">
                <b>总餐费：</b>
            </td>
            <td colspan="1" align="right">
                <b>${sum/10}</b>
            </td>
            <td colspan="1" align="right">
                <b>${dis_sum/10,numberFormat="##.##"}</b>
            </td>
        </tr>
        <%
        }
        %>

        <%
        }
        %>
        </tbody>
    </table>
</form>
</html>